package com.gulimall.cart.service;

import com.gulimall.cart.vo.Cart;
import com.gulimall.cart.vo.CartItem;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @author djg
 * @date 2020/9/2
 * @des
 */
public interface CartService {
    CartItem addToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 获取购物车中的一个购物项
     * @param skuId
     * @return
     */
    CartItem getCartItem(Long skuId);

    /**
     * 获取整个购物车
     * @return
     */
    Cart getCart() throws ExecutionException, InterruptedException;


    /**
     * 清空购物车数据
     * @param cartKey
     */
    void clearCart(String cartKey);

    void checkItem(Long skuId, Integer check);

    /**
     * 修改购物项的数量
     * @param skuId
     * @param num
     */
    void changeItemCount(Long skuId, Integer num);

    /**
     * 删除购物项
     * @param skuId
     */
    void deleteItem(Long skuId);

    List<CartItem> getUserCartItems();
}
